<?php
namespace app\index\controller;
class Article extends Base
{
    public function index($id){
		//当前文章内容
		$cacheName = $id.'_arts';
		if(cache($cacheName)){
			$arts = cache($cacheName);
		}else{
			$arts=db('article')->find($id);
			if($this->config['cache'] == '是'){
				cache($cacheName,$arts,$this->config['cache_time']);
			}
		}
   		//普通栏目分类
		if(cache('comCates')){
			$comCates=cache('comCates');
		}else{
			$comCates = model('cate')->getComCates();
			cache('comCates',$comCates,3600);
		}
   		
   		//帮助左侧栏目分类
		if(cache('shopHelpCates')){
			$shopHelpCates=cache('shopHelpCates');
		}else{
			$shopHelpCates=model('cate')->shopHelpCates();
			cache('shopHelpCates',$shopHelpCates,3600);
		}
		//面包屑导航
		$position = model('cate')->position($arts['cate_id']);
	   // $position[] = model('cate')->find($arts['cate_id']);
	   $this->assign([
		'show_right' => 1, //文章列表和商品列表头部偏移判断
		'comCates'  => $comCates,
		'shopHelpCates'=>$shopHelpCates,
		'arts'=>$arts,
		'position'=>$position
	   ]);
		return view('article');
	   }
}
